<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<canvas id="canvas" style="border: 1px solid red;"></canvas>
		<script type="text/javascript">
			var canvas = document.getElementById("canvas")
			var cxt = canvas.getContext("2d")
			var img = new Image();
			canvas.width = 400;
			canvas.height = 300;
			
			var bgcanvas = document.createElement("canvas");
			bgcanvas.width = 20
			bgcanvas.height = 20
			bgCxt = bgcanvas.getContext("2d")
			bgCxt.beginPath()
			bgCxt.arc(10, 10, 10, 0, 2*Math.PI, true)
			bgCxt.closePath()
			bgCxt.fillStyle = "#22c5d4"
			bgCxt.fill()
			
			var pattern = cxt.createPattern(bgcanvas, "repeat")
			cxt.fillStyle = pattern			
			cxt.fillRect(0, 0, canvas.width, canvas.height)
		</script>
	</body>
</html>
